package com.wanlian.router.ui.manage;

import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;

import com.smart.android.ui.BaseActivity;
import com.smart.android.utils.UIUtils;
import com.wanlian.router.R;

import butterknife.BindView;

/**
 * Created by Hyu on 2018/9/8.
 * Email: fvaryu@163.com
 */
public class WifiSettingActivity extends BaseActivity {

    @BindView(R.id.tab_layout)
    TabLayout mTabLayout;
    @BindView(R.id.viewpager)
    ViewPager mViewPager;

    @Override
    protected int layout() {
        return R.layout.activity_wifi_setting;
    }

    @Override
    public void initUI() {
        super.initUI();
        setTitle("WiFi设置");
    }

    @Override
    public void initData() {
        super.initData();
        mViewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int i) {
                switch (i) {
                    case 0: {
                        return WifiSettingFragment.newInstance(0);
                    }
                    case 1: {
                        return WifiSettingFragment.newInstance(1);
                    }
                    case 2: {
                        return WifiSettingFragment.newInstance(2);
                    }
                }
                return null;
            }

            @Override
            public int getCount() {
                return 3;
            }

            @Nullable
            @Override
            public CharSequence getPageTitle(int position) {
                switch (position) {
                    case 0:
                        return "2.4G";
                    case 1:
                        return "5G";
                    case 2:
                        return "访客网络";
                }
                return null;
            }
        });

        mTabLayout.setupWithViewPager(mViewPager);
        UIUtils.setIndicator(mTabLayout, 35, 35);
    }
}
